package com.distribute.pojo.workflow;

import com.distribute.pojo.Task.Location;
import com.distribute.pojo.enums.ReleaseState;
import com.distribute.utils.JsonUtils;
import com.fasterxml.jackson.core.type.TypeReference;

import java.util.Date;
import java.util.List;

public class WorkflowDefinition {

    private int id;

    private long code;

    private String name;

    private int version;

    private String releaseState;

    private long projectCode;

    private String description;

    private Object globalParams;

    private Object globalParamList;

    private Object globalParamMap;

    private Date createTime;

    private Date updateTime;

    private String flag;

    private int userId;

    private String userName;

    private String projectName;

    private List<Location> locations;

    private ReleaseState scheduleReleaseState;

    private int timeout;

    private int tenantId;

    private String tenantCode;

    private String modifyBy;

    private int warningGroupId;

    private WorkflowExecutionTypeEnum executionType;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public long getCode() {
        return code;
    }

    public void setCode(long code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public String getReleaseState() {
        return releaseState;
    }

    public void setReleaseState(String releaseState) {
        this.releaseState = releaseState;
    }

    public long getProjectCode() {
        return projectCode;
    }

    public void setProjectCode(long projectCode) {
        this.projectCode = projectCode;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Object getGlobalParams() {
        return globalParams;
    }

    public void setGlobalParams(Object globalParams) {
        this.globalParams = globalParams;
    }

    public Object getGlobalParamList() {
        return globalParamList;
    }

    public void setGlobalParamList(Object globalParamList) {
        this.globalParamList = globalParamList;
    }

    public Object getGlobalParamMap() {
        return globalParamMap;
    }

    public void setGlobalParamMap(Object globalParamMap) {
        this.globalParamMap = globalParamMap;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public List<Location> getLocations() {
        return locations;
    }

    public void setLocations(List<Location> locations) {
        this.locations = locations;
    }

    public void setLocations(String locations) {
        List<Location> list = JsonUtils.toList(locations, new TypeReference<List<Location>>() {
        });
        this.locations = list;
    }

    public ReleaseState getScheduleReleaseState() {
        return scheduleReleaseState;
    }

    public void setScheduleReleaseState(ReleaseState scheduleReleaseState) {
        this.scheduleReleaseState = scheduleReleaseState;
    }

    public int getTimeout() {
        return timeout;
    }

    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }

    public int getTenantId() {
        return tenantId;
    }

    public void setTenantId(int tenantId) {
        this.tenantId = tenantId;
    }

    public String getTenantCode() {
        return tenantCode;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    public String getModifyBy() {
        return modifyBy;
    }

    public void setModifyBy(String modifyBy) {
        this.modifyBy = modifyBy;
    }

    public int getWarningGroupId() {
        return warningGroupId;
    }

    public void setWarningGroupId(int warningGroupId) {
        this.warningGroupId = warningGroupId;
    }

    public WorkflowExecutionTypeEnum getExecutionType() {
        return executionType;
    }

    public void setExecutionType(WorkflowExecutionTypeEnum executionType) {
        this.executionType = executionType;
    }

    @Override
    public String toString() {
        return "WorkFlowDefinition{" +
                "id=" + id +
                ", code=" + code +
                ", name='" + name + '\'' +
                ", version=" + version +
                ", releaseState='" + releaseState + '\'' +
                ", projectCode=" + projectCode +
                ", description='" + description + '\'' +
                ", globalParams=" + globalParams +
                ", globalParamList=" + globalParamList +
                ", globalParamMap=" + globalParamMap +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", flag='" + flag + '\'' +
                ", userId=" + userId +
                ", userName='" + userName + '\'' +
                ", projectName='" + projectName + '\'' +
                ", locations=" + locations +
                ", scheduleReleaseState=" + scheduleReleaseState +
                ", timeout=" + timeout +
                ", tenantId=" + tenantId +
                ", tenantCode='" + tenantCode + '\'' +
                ", modifyBy='" + modifyBy + '\'' +
                ", warningGroupId=" + warningGroupId +
                ", executionType=" + executionType +
                '}';
    }
}
